import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;


public class Environment {
	public static final int B = 1;
	public static final int KB = 1024; 
	public static final int KB64 = 64*KB;
		
	private Integer _port;
	private Integer _size;
	private Integer _nbThread;

	public Environment(){
		_size = B; 
		_nbThread = 1;
		generatePort();
	}
	
	public void generatePort(){
		Random rand = new Random();
		_port = 6000 + rand.nextInt(1000);
		try {
			FileWriter fstream = new FileWriter("../../.BMport");
			BufferedWriter out = new BufferedWriter(fstream);
			out.write(_port.toString());
			out.close();
		} catch (IOException e) {
			e.printStackTrace();
		}

	}
	
	public Integer get_port() {
		return _port;
	}

	public Integer get_size() {
		return _size;
	}

	public void set_size(Integer size) {
		_size = size;
	}

	public Integer get_nbThread() {
		return _nbThread;
	}

	public void set_nbThread(Integer _nbThread) {
		this._nbThread = _nbThread;
	}

	public void toPrint() {
		System.out.println("port "+_port);
		System.out.println("size "+_size);
		System.out.println("thread  "+_nbThread);
		
	}
	
}
